<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateO2oGoodsProductTable1554107701 extends Migration
{
    /**
     * 积分-门店关系表 
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        $prefix = config('ibrand.app.database.prefix', 'ibrand_');
        if(!Schema::hasTable($prefix.'o2o_goods_product')){
	        Schema::create($prefix.'o2o_goods_product', function (Blueprint $table) {
		        $table->increments('id');
		        $table->integer('goods_id'); //el_goods表主键
		        $table->integer('o2o_goods_id'); //o2o_goods表主键
		        $table->integer('shop_id')->comment('店铺id');
		        $table->integer('product_id')->default(0); //el_goods_product表主键ID
		        $table->integer('store_nums')->default(0); //库存
		        $table->timestamps();
	        });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        $prefix = config('ibrand.app.database.prefix', 'ibrand_');
        Schema::drop($prefix.'o2o_goods_product');
    }
}
